package com.zc.angelica.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zc.angelica.entity.ResponseData;
import com.zc.angelica.mapper.ClientInfoMapper;
import com.zc.angelica.entity.ClientInfo;
import com.zc.angelica.service.ClientInfoService;
import org.springframework.stereotype.Service;

/**
 * 客户端信息表(ClientInfo)表服务实现类
 *
 * @author makejava
 * @since 2022-04-10 18:33:26
 */
@Service
public class ClientInfoServiceImpl extends ServiceImpl<ClientInfoMapper, ClientInfo> implements ClientInfoService {

    @Override
    public ResponseData addClientInfo(ClientInfo clientInfo) {
        boolean save = this.save(clientInfo);
        if(save){
            return ResponseData.success("添加成功");
        }
        return ResponseData.error("添加失败");
    }

    @Override
    public ResponseData deleteClientInfo(Long id) {
        boolean remove = this.removeById(id);
        if(remove){
            return ResponseData.success("删除成功");
        }
        return ResponseData.error("删除失败");
    }

    @Override
    public ResponseData updateClientInfo(ClientInfo clientInfo) {
        boolean update = this.updateById(clientInfo);
        if(update){
            return ResponseData.success("更新成功");
        }
        return ResponseData.error("更新失败");
    }

    @Override
    public ResponseData getClientInfo() {
        return ResponseData.success(this.list());
    }
}

